<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setDateHeader("Expires", 0);
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>
	<head lang="en">
	    <meta charset="UTF-8">
	    <title>企业列表</title>
		<jsp:include page="../common/top.jsp"></jsp:include>
  	</head>
	<body class="page-content">
		<div class="page-content-area" data-ajax-content="true">
			<div class="page-header">
				<h1>企业列表</h1>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="row">
						<div class="col-xs-12">
							<div class="widget-box">
								<div class="widget-header widget-header-small">
									<h5 class="widget-title lighter">搜索栏</h5>
								</div>
			
								<div class="widget-body">
									<div class="widget-main">
										<form id="_form" class="form-inline">
											 <%-- <label>
												<label class="control-label" for="form-field-1"> 目录分类： </label>
												<select id="catalogId" name="catalogId" class="form-data input-medium search-data">
													<option value="">全部</option>
													<c:forEach var="catalog" items="${catalogList }">
														<option value="${catalog.id }">${catalog.name }(&nbsp;${catalog.type == 3 ? "单独子目录" : "子目录"}&nbsp;)</option>
													</c:forEach>
												</select>
											</label>--%>
											
											<label>
													<label class="control-label" for="form-field-1"> 公司名字 </label>
													<input name="公司名字" type="text" class="form-data input-medium search-data">
											</label>
											
										</form> 
									</div>
								</div>
							</div>
							<div>
								<div class="dataTables_wrapper form-inline no-footer">
									<table id="_table" class="table table-striped table-bordered table-hover dataTable no-footer"></table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<jsp:include page="../common/bottom.jsp"></jsp:include>
		<script type="text/javascript">
			var $table;
			jQuery(function($) {
				// 列表
	    		 $table = $("#_table").table({
	    			url : "${path}/admin/company/list",
	    			formId : "_form",
					tools : [
					 	{text : '添加企业信息', clazz : 'btn-info', icon : 'fa fa-plus-circle blue', permission : '/admin/company/edit', handler : function(){
							window.location.href = "${path}/admin/company/edit";
						}}, 
						{text : '删除', clazz : 'btn-danger', icon : 'fa fa-trash-o red', permission : '/admin/company/delete', handler : function(){
							$table.ajaxDelete({
								confirm : "该操作会删除选中的图文信息，确定执行吗?", 
								url : "${path}/admin/company/delete"
							});
						}}
					],
					columns : [
				        {field:'id', hide : true},
				       
				        {field:'companyName', title:'公司名称', align:'left'},
				        {field:'tradeName', title:'所属行业', align:'left'},
				        {field:'jobCount', title:'招聘职位个数', align:'left'},
				        {field:'personCount', title:'公司规模', align:'left',
				        	 replace:function(row){
					        		if(row.personCount == 0){
					        			return "0-20人";
					        		}else if(row.personCount == 1){
					        			return "20-99人";
					        		}else if(row.personCount == 2){
					        			return "100-499人";
					        		}else if(row.personCount == 3){
					        			return "500-999人";
					        		}else{
					        			return "1000人以上"
					        		}
					        		}},
				        {field:'addressDetail', title:'公司详细地址', align:'left'},
				        {field:'companyPhone', title:'公司联系方式', align:'left'}
				        ],
					operate : [
						{text : '编辑企业', clazz : 'blue', icon : 'fa fa-pencil', permission : '/admin/company/edit', handler : function(d, i){
							window.location.href = "${path}/admin/company/edit?id=" + d.id;
						}},
						{text : '新增该企业职位', clazz : 'blue', icon : 'fa fa-plus-circle', permission : '/admin/company/edits', handler : function(d, i){
							window.location.href = "${path}/admin/job/edits?id=" + d.id;
						}},
						{text : '删除', clazz : 'red', icon : 'fa fa-trash-o', permission : '/admin/company/delete', handler : function(d, i){
							$table.ajaxDelete({
								confirm : "该操作会删除选中的企业信息，确定执行吗?", 
								url : "${path}/admin/company/delete"
							});
						}}
					],
					after : function(){
						// 权限处理
						$.permission();
					}
				});
				
			});
			
		</script>

	</body>
</html>

